package class1.s2022350143027.service.Impl;

import class1.s2022350143027.data.UsersData;
import class1.s2022350143027.model.UserModel;
import class1.s2022350143027.service.YzyLoginService;
import class1.s2022350143027.service.YzyLoginService;

import java.util.List;


/**
 * 登录业务逻辑实现
 * @author yzy
 * @date 2024-05-02
 */
public class YzyLoginServiceImpl implements YzyLoginService {

    protected UsersData usersData = new UsersData();
    
    public void add_all(List<UserModel> usersData) {
        this.usersData.addAllUserDataList(usersData);
    }

    @Override
    public boolean checkLogin(UserModel loginUser) {
        UserModel user = usersData.get(loginUser.getUsername());
        if(user!=null){
            return user.getPassword().equals(loginUser.getPassword());
        }else{
            return false;
        }
    }
}
